#!/bin/bash

# Test object cache reclaim and size parameter

. ./common

for i in `seq 0 5`; do
    _start_sheep $i "-w size=20M"
done

_wait_for_sheep 6

_cluster_format -c 2

_vdi_create test 40M

_random | $DOG vdi write test

# check cache size, should be 20 * 80%
nr=`ls $STORE/0/cache/7c2b25 | wc -l`
if [ $nr -gt 4 ]; then
    echo "reclaim failed"
fi

_cleanup

_start_sheep 0 "-w size=200M"
_start_sheep 1 "-w size=200G"
_start_sheep 2 "-w size=20T"

_wait_for_sheep 3

_cluster_format -c 3

for i in 0 1 2; do
    $DOG vdi cache info -p 700$i
done
